﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordStyles : IEnumerable<WordStyle>
    {
        public WordStyle this[int index]
        {
            get { return new WordStyle(_styles[index]); }
        }

        public WordStyle this[string index]
        {
            get { return new WordStyle(_styles[index]); }
        }

        private Styles _styles;

        internal WordStyles(Styles styles)
        {
            _styles = styles;
        }


        #region IEnumerable<WordStyle> 成员

        public IEnumerator<WordStyle> GetEnumerator()
        {
            foreach (Style style in _styles)
            {
                yield return new WordStyle(style);
            }
        }

        #endregion

        #region IEnumerable 成员

        IEnumerator IEnumerable.GetEnumerator()
        {
            foreach (Style style in _styles)
            {
                yield return new WordStyle(style);
            }
        }

        #endregion

    }
}
